<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/tcpSvr.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">tcpSvr.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../df/ddf/tcp_svr_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span><span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="preprocessor">#include &lt;uv.h&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#include &quot;<a class="code" href="../../dc/d4b/uvlper_8hpp.html">uvlper.hpp</a>&quot;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="preprocessor">#include &quot;<a class="code" href="../../dd/d42/connection_8hpp.html">connection.hpp</a>&quot;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#include &quot;<a class="code" href="../../dd/d5a/dcitfc_8hpp.html">dcitfc.hpp</a>&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span> </div>
<div class="foldopen" id="foldopen00023" data-start="{" data-end="};">
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html">   23</a></span><span class="keyword">class </span><a class="code hl_class" href="../../d2/d50/classtcp_svr.html">tcpSvr</a> : <span class="keyword">public</span> <a class="code hl_struct" href="../../de/d17/structdc_itfc.html">dcItfc</a></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span>{</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span><span class="keyword">public</span>:</div>
<div class="foldopen" id="foldopen00026" data-start="{" data-end="};">
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6">   26</a></span>    <span class="keyword">enum</span> <a class="code hl_enumeration" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6">emErrCode</a>{</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6aa63bce0a43eb55a8340508cbe295a3a5">   27</a></span>        <a class="code hl_enumvalue" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6aa63bce0a43eb55a8340508cbe295a3a5">ERR_ALLOC_MEM</a> = -1000,</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6a3f26a076df1905cc8ff903fee6385d01">   28</a></span>        <a class="code hl_enumvalue" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6a3f26a076df1905cc8ff903fee6385d01">ERR_INIT</a>,</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6ae5c21a09e002d724b2286c5f930f90b5">   29</a></span>        <a class="code hl_enumvalue" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6ae5c21a09e002d724b2286c5f930f90b5">ERR_LISTEN</a>,</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>        <a class="code hl_enumvalue" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6a352c2aa603754295e5cb923b81857d83">OK</a> = 0</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6a352c2aa603754295e5cb923b81857d83">   31</a></span>    };</div>
</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span>    uv_tcp_t                                          __m_tcp;                   <span class="comment">// </span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>    std::map&lt; std::string , tcpConnect* &gt;             __m_clients;               <span class="comment">// 连接的客户端</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span>    std::function&lt;void ( <span class="keyword">const</span> std::string&amp; data ) &gt;  m_funUpdtTbl;     <span class="comment">// 数据回调</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span>    std::mutex    m_mutex;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>    <span class="keywordtype">int</span>           __m_port;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    std::function&lt; void ( <span class="keywordtype">int</span> err ) &gt;         cb_err;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    std::function&lt; void () &gt;              cb_connected;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    std::function&lt; void ( <span class="keyword">const</span> std::string&amp; ) &gt;      cb_client_connected;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    std::function&lt; void ( <span class="keyword">const</span> std::string&amp; ) &gt;      cb_client_disconnected;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    std::function&lt; void ( ) &gt;             cb_closed;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    std::function&lt; void ( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len )&gt; cb_recved;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>    std::function&lt; void ( <span class="keywordtype">int</span> err ) &gt;                 cb_sended;</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    std::function&lt; void ()&gt;               cb_stop;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>    <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#ac11f12960c2655654da062d206a0fe01">tcpSvr</a>( );</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>    <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#ac11f12960c2655654da062d206a0fe01">tcpSvr</a>( <span class="keyword">const</span> std::string&amp; ip, <span class="keywordtype">int</span> port );</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a5276b4330fb248b0b2312edd323e3baa">~tcpSvr</a>();</div>
<div class="foldopen" id="foldopen00059" data-start="{" data-end="}">
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a4add02ff33836fd7682ebde58f1a606a">   59</a></span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a4add02ff33836fd7682ebde58f1a606a">onUpdateTbl</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> std::string&amp; data ) &gt; fun ){</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>        m_funUpdtTbl = fun;</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>    }</div>
</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span> </div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a0f76b1e77ef99c4b0d8aa35e4bec2aba">connect</a>( <span class="keyword">const</span> std::string&amp; url , <span class="keywordtype">bool</span> bind = <span class="keyword">false</span> ) final;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a37a59a25e5b004011b96c96aacb9cce9">send</a>( const <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len ) final;</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#ab29c078f0fe5b2a6d7f7723e535c9bcd">close</a>() final;</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a764f972608217fda804f163f8161bba1">onRecv</a>( const <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len ) final;</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#aadbc4fb737284bf3ea64166fc188867f">onError</a>( <span class="keywordtype">int</span> err ) final;</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a31000bcdb772f0e6e5379673b441a0ed">onConnected</a>() final;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a902f2d204f63a7c56cf8ddcad8891e47">onDisconnected</a>() final;</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a0c8b8d9b62b578170ff55f620455ad7a">onClose</a>() final;</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#af62c43e6a3a16e353d42f50028668ce4">onSend</a>( <span class="keywordtype">int</span> err ) final;</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>    virtual <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a1c3315642ee239fa39e4bd6f5bd9afd0">onClientConnected</a>() final;</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"><a class="line" href="../../d2/d50/classtcp_svr.html#a52861dbf4db48f2dfc7a88c31d18aef8">   74</a></span>    virtual const <a class="code hl_namespace" href="../../d8/dcc/namespacestd.html">std</a>::<span class="keywordtype">string</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a52861dbf4db48f2dfc7a88c31d18aef8">type</a>()<span class="keyword"> const</span>{ <span class="keywordflow">return</span> std::string( <span class="stringliteral">&quot;tcpserver&quot;</span> ); }</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span> </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a59f4dfec6bfc99048cc71072210d526c">evtError</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keywordtype">int</span> err ) &gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a2e68bfd470bb9db9b758a575f5aad5b7">evtConnected</a>( std::function&lt; <span class="keywordtype">void</span> () &gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a23ac4cb70bee9eae64582ddde4630331">evtClientConnected</a>( std::function&lt; <span class="keywordtype">void</span> (<span class="keyword">const</span> std::string&amp; ) &gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#af49ec64c530988f230b9df265b1041c4">evtClientDisconnected</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> std::string&amp; ) &gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#ac36b5e29b718f1deb99ad69e4c1803d1">evtClosed</a>( std::function&lt; <span class="keywordtype">void</span> ( ) &gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#ad5e4c03d0b81738911580933263c82c7">evtRecv</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len )&gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#abb75cef0d726b5d402a4349a07194296">evtSend</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keywordtype">int</span> err ) &gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a8f2269332703e9cc735e9e5d4a71705b">evtStop</a>( std::function&lt; <span class="keywordtype">void</span> ()&gt; fun ) <span class="keyword">final</span>;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span>    <span class="comment">/*</span></div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span><span class="comment">     * 处理新链接</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span><span class="comment">     * @param sock[ I ], 操作系统套接字句柄编号</span></div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span><span class="comment">     */</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#ab02384e56ed993d541cd8515677b59ac">incomingConnection</a>( <span class="keywordtype">int</span> status );</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a0a91e51bf5771438dc49b1b32a2618c0">onRecvData</a>( <span class="keyword">const</span> std::string&amp; name , <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len );</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#a902f2d204f63a7c56cf8ddcad8891e47">onDisconnected</a>( <span class="keyword">const</span> std::string&amp; name );</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d50/classtcp_svr.html#aafa854488ad50ba9761a3bb129764637">onClientError</a>( <span class="keyword">const</span> std::string&amp; name , <a class="code hl_enumeration" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">tcpConnect::emErrCode</a> code , <span class="keyword">const</span> std::string&amp; msg );</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span>    <span class="keywordtype">bool</span> __init( <span class="keyword">const</span> std::string&amp; ip, <span class="keywordtype">int</span> port);</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>    <span class="keywordtype">void</span> __close_all_clients();</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span>    <span class="keywordtype">void</span> __on_acpt_err( <span class="keywordtype">int</span> err );</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>    std::string __get_peer_ip_port( uv_tcp_t * conn );</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>};</div>
</div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76a"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">tcpConnect::emErrCode</a></div><div class="ttdeci">emErrCode</div><div class="ttdef"><b>定义</b> <a href="../../dd/d42/connection_8hpp_source.html#l00019">connection.hpp:19</a></div></div>
<div class="ttc" id="aclasstcp_svr_html"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html">tcpSvr</a></div><div class="ttdoc">使用LIBUV实现的TCP服务器模块</div><div class="ttdef"><b>定义</b> <a href="#l00023">tcpSvr.hpp:24</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a0a91e51bf5771438dc49b1b32a2618c0"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a0a91e51bf5771438dc49b1b32a2618c0">tcpSvr::onRecvData</a></div><div class="ttdeci">void onRecvData(const std::string &amp;name, const char *data, size_t len)</div><div class="ttdoc">处理接收到数据，对数据进行解析，呈现等操作</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00139">tcpSvr.cpp:139</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a0c8b8d9b62b578170ff55f620455ad7a"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a0c8b8d9b62b578170ff55f620455ad7a">tcpSvr::onClose</a></div><div class="ttdeci">virtual void onClose() final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00242">tcpSvr.cpp:242</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a0f76b1e77ef99c4b0d8aa35e4bec2aba"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a0f76b1e77ef99c4b0d8aa35e4bec2aba">tcpSvr::connect</a></div><div class="ttdeci">virtual void connect(const std::string &amp;url, bool bind=false) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00183">tcpSvr.cpp:183</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a1c3315642ee239fa39e4bd6f5bd9afd0"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a1c3315642ee239fa39e4bd6f5bd9afd0">tcpSvr::onClientConnected</a></div><div class="ttdeci">virtual void onClientConnected() final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00254">tcpSvr.cpp:254</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a23ac4cb70bee9eae64582ddde4630331"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a23ac4cb70bee9eae64582ddde4630331">tcpSvr::evtClientConnected</a></div><div class="ttdeci">virtual void evtClientConnected(std::function&lt; void(const std::string &amp;) &gt; fun) final</div><div class="ttdoc">对于服务器有效</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00270">tcpSvr.cpp:270</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a2e68bfd470bb9db9b758a575f5aad5b7"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a2e68bfd470bb9db9b758a575f5aad5b7">tcpSvr::evtConnected</a></div><div class="ttdeci">virtual void evtConnected(std::function&lt; void() &gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00265">tcpSvr.cpp:265</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a31000bcdb772f0e6e5379673b441a0ed"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a31000bcdb772f0e6e5379673b441a0ed">tcpSvr::onConnected</a></div><div class="ttdeci">virtual void onConnected() final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00230">tcpSvr.cpp:230</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a36b3958f1a4acbd7be1c0126160d5db6"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6">tcpSvr::emErrCode</a></div><div class="ttdeci">emErrCode</div><div class="ttdef"><b>定义</b> <a href="#l00026">tcpSvr.hpp:26</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a36b3958f1a4acbd7be1c0126160d5db6a352c2aa603754295e5cb923b81857d83"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6a352c2aa603754295e5cb923b81857d83">tcpSvr::OK</a></div><div class="ttdeci">@ OK</div><div class="ttdef"><b>定义</b> <a href="#l00031">tcpSvr.hpp:30</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a36b3958f1a4acbd7be1c0126160d5db6a3f26a076df1905cc8ff903fee6385d01"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6a3f26a076df1905cc8ff903fee6385d01">tcpSvr::ERR_INIT</a></div><div class="ttdeci">@ ERR_INIT</div><div class="ttdef"><b>定义</b> <a href="#l00028">tcpSvr.hpp:28</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a36b3958f1a4acbd7be1c0126160d5db6aa63bce0a43eb55a8340508cbe295a3a5"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6aa63bce0a43eb55a8340508cbe295a3a5">tcpSvr::ERR_ALLOC_MEM</a></div><div class="ttdeci">@ ERR_ALLOC_MEM</div><div class="ttdef"><b>定义</b> <a href="#l00027">tcpSvr.hpp:27</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a36b3958f1a4acbd7be1c0126160d5db6ae5c21a09e002d724b2286c5f930f90b5"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a36b3958f1a4acbd7be1c0126160d5db6ae5c21a09e002d724b2286c5f930f90b5">tcpSvr::ERR_LISTEN</a></div><div class="ttdeci">@ ERR_LISTEN</div><div class="ttdef"><b>定义</b> <a href="#l00029">tcpSvr.hpp:29</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a37a59a25e5b004011b96c96aacb9cce9"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a37a59a25e5b004011b96c96aacb9cce9">tcpSvr::send</a></div><div class="ttdeci">virtual void send(const char *data, size_t len) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00197">tcpSvr.cpp:197</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a4add02ff33836fd7682ebde58f1a606a"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a4add02ff33836fd7682ebde58f1a606a">tcpSvr::onUpdateTbl</a></div><div class="ttdeci">void onUpdateTbl(std::function&lt; void(const std::string &amp;data) &gt; fun)</div><div class="ttdoc">设置数据更新处理的回调函数。主要用来更新表格和文件</div><div class="ttdef"><b>定义</b> <a href="#l00059">tcpSvr.hpp:59</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a5276b4330fb248b0b2312edd323e3baa"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a5276b4330fb248b0b2312edd323e3baa">tcpSvr::~tcpSvr</a></div><div class="ttdeci">~tcpSvr()</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00037">tcpSvr.cpp:37</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a52861dbf4db48f2dfc7a88c31d18aef8"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a52861dbf4db48f2dfc7a88c31d18aef8">tcpSvr::type</a></div><div class="ttdeci">virtual const std::string type() const</div><div class="ttdef"><b>定义</b> <a href="#l00074">tcpSvr.hpp:74</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a59f4dfec6bfc99048cc71072210d526c"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a59f4dfec6bfc99048cc71072210d526c">tcpSvr::evtError</a></div><div class="ttdeci">virtual void evtError(std::function&lt; void(int err) &gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00261">tcpSvr.cpp:261</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a764f972608217fda804f163f8161bba1"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a764f972608217fda804f163f8161bba1">tcpSvr::onRecv</a></div><div class="ttdeci">virtual void onRecv(const char *data, size_t len) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00217">tcpSvr.cpp:217</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a8f2269332703e9cc735e9e5d4a71705b"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a8f2269332703e9cc735e9e5d4a71705b">tcpSvr::evtStop</a></div><div class="ttdeci">virtual void evtStop(std::function&lt; void()&gt; fun) final</div><div class="ttdoc">对于服务器有效.用于关闭监听</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00288">tcpSvr.cpp:288</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_a902f2d204f63a7c56cf8ddcad8891e47"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#a902f2d204f63a7c56cf8ddcad8891e47">tcpSvr::onDisconnected</a></div><div class="ttdeci">virtual void onDisconnected() final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00236">tcpSvr.cpp:236</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_aadbc4fb737284bf3ea64166fc188867f"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#aadbc4fb737284bf3ea64166fc188867f">tcpSvr::onError</a></div><div class="ttdeci">virtual void onError(int err) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00224">tcpSvr.cpp:224</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_aafa854488ad50ba9761a3bb129764637"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#aafa854488ad50ba9761a3bb129764637">tcpSvr::onClientError</a></div><div class="ttdeci">void onClientError(const std::string &amp;name, tcpConnect::emErrCode code, const std::string &amp;msg)</div><div class="ttdoc">处理客户端错误</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00165">tcpSvr.cpp:165</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_ab02384e56ed993d541cd8515677b59ac"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#ab02384e56ed993d541cd8515677b59ac">tcpSvr::incomingConnection</a></div><div class="ttdeci">void incomingConnection(int status)</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00073">tcpSvr.cpp:73</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_ab29c078f0fe5b2a6d7f7723e535c9bcd"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#ab29c078f0fe5b2a6d7f7723e535c9bcd">tcpSvr::close</a></div><div class="ttdeci">virtual void close() final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00207">tcpSvr.cpp:207</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_abb75cef0d726b5d402a4349a07194296"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#abb75cef0d726b5d402a4349a07194296">tcpSvr::evtSend</a></div><div class="ttdeci">virtual void evtSend(std::function&lt; void(int err) &gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00283">tcpSvr.cpp:283</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_ac11f12960c2655654da062d206a0fe01"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#ac11f12960c2655654da062d206a0fe01">tcpSvr::tcpSvr</a></div><div class="ttdeci">tcpSvr()</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00019">tcpSvr.cpp:19</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_ac36b5e29b718f1deb99ad69e4c1803d1"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#ac36b5e29b718f1deb99ad69e4c1803d1">tcpSvr::evtClosed</a></div><div class="ttdeci">virtual void evtClosed(std::function&lt; void() &gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00275">tcpSvr.cpp:275</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_ad5e4c03d0b81738911580933263c82c7"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#ad5e4c03d0b81738911580933263c82c7">tcpSvr::evtRecv</a></div><div class="ttdeci">virtual void evtRecv(std::function&lt; void(const char *data, size_t len)&gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00279">tcpSvr.cpp:279</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_af49ec64c530988f230b9df265b1041c4"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#af49ec64c530988f230b9df265b1041c4">tcpSvr::evtClientDisconnected</a></div><div class="ttdeci">virtual void evtClientDisconnected(std::function&lt; void(const std::string &amp;) &gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00256">tcpSvr.cpp:256</a></div></div>
<div class="ttc" id="aclasstcp_svr_html_af62c43e6a3a16e353d42f50028668ce4"><div class="ttname"><a href="../../d2/d50/classtcp_svr.html#af62c43e6a3a16e353d42f50028668ce4">tcpSvr::onSend</a></div><div class="ttdeci">virtual void onSend(int err) final</div><div class="ttdef"><b>定义</b> <a href="../../dc/d4c/tcp_svr_8cpp_source.html#l00248">tcpSvr.cpp:248</a></div></div>
<div class="ttc" id="aconnection_8hpp_html"><div class="ttname"><a href="../../dd/d42/connection_8hpp.html">connection.hpp</a></div></div>
<div class="ttc" id="adcitfc_8hpp_html"><div class="ttname"><a href="../../dd/d5a/dcitfc_8hpp.html">dcitfc.hpp</a></div></div>
<div class="ttc" id="anamespacestd_html"><div class="ttname"><a href="../../d8/dcc/namespacestd.html">std</a></div><div class="ttdef"><b>定义</b> <a href="../../d1/d92/mandarava_2event_8hpp_source.html#l00038">event.hpp:39</a></div></div>
<div class="ttc" id="astructdc_itfc_html"><div class="ttname"><a href="../../de/d17/structdc_itfc.html">dcItfc</a></div><div class="ttdoc">数据通道接口，用来统一数据操作接口。 其中涉及到错误编号的时候，当错误编号小于0的时候是错误编号，等于0的时候是没有发生错误</div><div class="ttdef"><b>定义</b> <a href="../../dd/d5a/dcitfc_8hpp_source.html#l00014">dcitfc.hpp:15</a></div></div>
<div class="ttc" id="auvlper_8hpp_html"><div class="ttname"><a href="../../dc/d4b/uvlper_8hpp.html">uvlper.hpp</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
